﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bosphorus.Migrator.Core.CommandProcessor;
using Bosphorus.Migrator.Core.MigrationCommand;
using Bosphorus.Migrator.Core.Extractor;

namespace Bosphorus.Migrator.Core.Command.Processor.Generated
{
    public class GeneratedCommandProcessor<TReturn>: ICommandProcessor
    {
        private readonly IGenerator<TReturn> generator;
        private readonly IExtractor<TReturn> extractor;

        public GeneratedCommandProcessor(IGenerator<TReturn> generator, IExtractor<TReturn> extractor)
        {
            this.generator = generator;
            this.extractor = extractor;
        }

        public void Process(IList<ICommand> commands)
        {
            TReturn generatedResult = generator.Process(commands);
            extractor.Extract(generatedResult);
        }
    }
}
